package com.cn.service;

import com.cn.entity.CustomerSimpleInfo;
import com.cn.utils.StringUtil;
import com.cn.utlis.IBase;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by chenyuncong on 2019/5/10.
 */
@Service("customerSimpleInfoService")
public class CustomerSimpleInfoServiceImpl extends IBase<CustomerSimpleInfo> implements CustomerSimpleInfoService{

    public int cuCount(){
        String sql ="select count(1) from ( select customerPhone from c_customer_simple_info group by customerPhone ) aa";
        return this.count(sql);
    }

    @Override
    public List<CustomerSimpleInfo> getCustomerSimpleInfolimitList(Integer pageSize, Integer pageNumber) throws Exception {
        String sql ="select customerPhone,max(customerName) customerName from c_customer_simple_info group by customerPhone "+StringUtil.toLimit(pageSize,pageNumber);
        List<CustomerSimpleInfo> list = this.getList(sql,CustomerSimpleInfo.class);
        return list;
    }
}
